package com.harlov.robanuka.stages;

import org.anddev.andengine.engine.Engine;
import org.anddev.andengine.entity.primitive.Rectangle;
import org.anddev.andengine.entity.scene.Scene;
import org.anddev.andengine.entity.scene.background.SpriteBackground;
import org.anddev.andengine.entity.shape.Shape;
import org.anddev.andengine.entity.sprite.Sprite;
import org.anddev.andengine.entity.util.FPSLogger;
import org.anddev.andengine.extension.physics.box2d.PhysicsFactory;
import org.anddev.andengine.extension.physics.box2d.PhysicsWorld;

import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.FixtureDef;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;
import com.harlov.robanuka.support.resources;

public class newgame {
	
	// Настройки
	public static final int CAMERA_WIDTH = 480;
	public static final int CAMERA_HEIGHT = 320;
	public static final int NUMBER_OF_LAYERS = 2;
	public static final FixtureDef FIXTURE_DEF = PhysicsFactory.createFixtureDef(0, 0, 0.5f);
	//*******
	
	
	public newgame(final Scene mScene,final PhysicsWorld mWorld, final resources mRes, final Engine mEngine) {
		
		init(mScene,mWorld,mRes,mEngine);
	}
	
	private void init (Scene mScene,PhysicsWorld mWorld, resources mRes, Engine mEngine) //Инициализация мира
	{
		
		//Создание мира
		
		
				
		//Инициализация физ.движка
		final Shape ground = new Rectangle(0, CAMERA_HEIGHT - 2, CAMERA_WIDTH, 2);
		final Shape roof = new Rectangle(0, 0, CAMERA_WIDTH, 2);
		final Shape left = new Rectangle(0, 0, 2, CAMERA_HEIGHT);
		final Shape right = new Rectangle(CAMERA_WIDTH - 2, 0, 2, CAMERA_HEIGHT);
		
		final FixtureDef wallFixtureDef = PhysicsFactory.createFixtureDef(0, 0, 0);
		PhysicsFactory.createBoxBody(mWorld, ground, BodyType.StaticBody, wallFixtureDef);
		PhysicsFactory.createBoxBody(mWorld, roof, BodyType.StaticBody, wallFixtureDef);
		PhysicsFactory.createBoxBody(mWorld, left, BodyType.StaticBody, wallFixtureDef);
		PhysicsFactory.createBoxBody(mWorld, right, BodyType.StaticBody, wallFixtureDef);
		
		mScene.attachChild(ground);
		mScene.attachChild(roof);
		mScene.attachChild(left);
		mScene.attachChild(right);

		mScene.registerUpdateHandler(mWorld);
		//*************
		
		
	
		

	}
}
